package com.yunze.system.service.impl.yunze.install;

import com.yunze.common.mapper.mysql.install.YzInstallEquipmentMapper;
import com.yunze.common.utils.yunze.PageUtil;
import com.yunze.system.service.yunze.install.YzInstallEquipmentService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Service
public class YzInstallEquipmentServiceImpl implements YzInstallEquipmentService {

    @Resource
    private YzInstallEquipmentMapper yzInstallEquipmentMapper;


    @Override
    public Map<String, Object> PstrMap(Map map) {
        Map<String, Object> omp=new HashMap<String, Object>();
        Integer currenPage=map.get("pageNum")!=null?Integer.parseInt(map.get("pageNum").toString()):0;
        Integer pageSize=map.get("pageSize")!=null?Integer.parseInt(map.get("pageSize").toString()):10;
        Integer rowCount = yzInstallEquipmentMapper.selMapCount(map);
        rowCount=rowCount!=null?rowCount:0;
        PageUtil pu=new PageUtil(rowCount,currenPage , pageSize);//初始化分页工具类
        //数据打包
        map.put("StarRow", pu.getStarRow());
        map.put("PageSize", pu.getPageSize());
        omp.put("Pu", pu);
        omp.put("Data", yzInstallEquipmentMapper.selMap(map));
        return omp;
    }

    @Override
    public List<Map<String, Object>> selAdd(Map map) {
        return yzInstallEquipmentMapper.selAdd(map);
    }

    @Override
    public List<Map<String, Object>> selBuilding(Map map) {
        return yzInstallEquipmentMapper.selBuilding(map);
    }

    @Override
    public List<Map<String, Object>> selFllor(Map map) {
        return yzInstallEquipmentMapper.sleFloor(map);
    }

    @Override
    public List<Map<String, Object>> sleAlarm(Map map) {
        return yzInstallEquipmentMapper.sleAlarm(map);
    }

    @Override
    public boolean add(Map map) {
        System.out.println(map);

        return yzInstallEquipmentMapper.add(map)>0;
    }

    @Override
    public List<Map<String, Object>> household(Map map) {
        return yzInstallEquipmentMapper.household(map);
    }


}
